" Vim syntax file
" Language:	CongKit
" Maintainer:	Niujie
" Last Change:	2024 Oct 31


" quit when a syntax file was already loaded.
if exists("b:current_syntax")
  finish
endif

" We need nocompatible mode in order to continue lines with backslashes.
" Original setting will be restored.
let s:cpo_save = &cpo
set cpo&vim

" Keyword can find in this URL.
" https://developer.huawei.com/consumer/cn/doc/cangjie-guides-V5/keyword-V5

syn keyword congkitStatement	FALSE TRUE
syn keyword congkitStatement	as break continue return class redef type
syn keyword congkitStatement	abstract Bool const extend func foreign interface
syn keyword congkitStatement	super static unsafe macro prop public private protected
syn keyword congkitStatement	var let mut struct
syn keyword congkitStatement	this synchronized This Nothing override operator
syn keyword congkitConditional	else if case match
syn keyword congkitRepeat		for while do
syn keyword congkitOperator		in is where 
syn keyword congkitException		try finally catch throw
syn keyword congkitInclude		import package
syn keyword congkitAsync		async await spawn
syn keyword congkitBuiltin		open main enum Rune VArray quote print println
syn keyword congkitType		init Float16 Float32 Float64
syn keyword congkitType		Int8 Int16 Int32 Int64 IntNative 
syn keyword congkitType		Unit UInt8 UInt16 UInt32 Uint64 UIntNative
syn keyword congkitTodo		contained TODO XXX

" syn region congkitLineComment	start="//.*" end="\n"
syn match congkitLineComment            "//.*" 
syn match congkitDecorator		"(?<=(@))[A-Za-z_][A-Za-z0-9_.]*"
syn region congkitComment		start="/\*" end="\*/" 
syn region congkitString		start=+"+ end=+"+
syn region congkitSingleQuote		start=+'+ end=+'+

" The default highlight links.  Can be overridden later.
hi def link congkitStatement		Statement
hi def link congkitConditional		Conditional
hi def link congkitRepeat		Repeat
hi def link congkitOperator		Operator
hi def link congkitException		Exception
hi def link congkitInclude		Include
hi def link congkitAsync		Statement
hi def link congkitBuiltin		Function
hi def link congkitType			Type
hi def link congkitLineComment		Comment
hi def link congkitComment		Comment
hi def link congkitString		String
hi def link congkitSingleQuote		String
hi def link congkitDecorator		Define
hi def link congkitTodo			Todo

let b:current_syntax = "congkit"

let &cpo = s:cpo_save
unlet s:cpo_save

" vim:set sw=2 sts=2 ts=8 noet:
